package com.qwz.example;

import com.qwz.example.component.Component;

import java.util.Date;
/**
* @Description: 装饰器对象，计算累计奖金
* @Package com.qwz.example.SumPrizeDecorator
* @author Qiuwuzhi
* @date 2019/12/19 13:44
* @version V1.0
*/
public class SumPrizeDecorator extends Decorator {
    /**
     * 通过构造方法传入被装饰的对象
     *
     * @param component
     */
    public SumPrizeDecorator(Component component) {
        super(component);
    }

    @Override
    public double calcPrize(String user, Date begin, Date end) {
        //计算前面运算出来的奖金
        double money = super.calcPrize(user, begin, end);
        //计算累计奖金
        //简单演示一下，假定大家的累计业务额都是1000000元
        double prize = 1000000 * 0.001;
        System.out.println(user+"-累计奖金-"+prize);
        return money + prize;
    }
}
